<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0"/>
    <title>搜索中心</title>
    <link type="image/x-icon" rel="shortcut icon" href="images/favicon.ico">
    <link rel="stylesheet" href="assets/mui/css/mui.css"/>
    <link rel="stylesheet" href="assets/fa/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="css/common.css"/>
    <link rel="stylesheet" href="css/search.css"/>
</head>
<body>
<div class="lt_container">
    <header class="lt_topBar">
        <a class="btn_left" href="javascript:history.back();"><span class="mui-icon mui-icon-arrowleft"></span></a>
        <h3>搜索中心</h3>
    </header>
    <div class="lt_content">
        <div class="lt_wrapper">
            <div class="mui-scroll-wrapper">
                <div class="mui-scroll">
                    <!--搜索表单-->
                    <div class="lt_search">
                        <form action="javascript:;">
                            <input class="search_input" type="search" placeholder="请输入搜索关键字"/>
                            <a class="search_btn" href="javascript:;">搜索</a>
                        </form>
                    </div>
                    <!--搜索历史-->
                    <div class="lt_history">
					    <!--动态渲染-->
					</div>
                </div>
            </div>
        </div>
    </div>
    <footer class="lt_tabBar">
        <ul>
            <li><a href="index.html"><span class="fa fa-home"></span><p>首页</p></a></li>
            <li><a href="category.html"><span class="fa fa-bars"></span><p>分类</p></a></li>
            <li><a href="user/cart.html"><span class="fa fa-shopping-cart"></span><p>购物车</p></a></li>
            <li><a href="user/myindex.html"><span class="fa fa-user"></span><p>会员中心</p></a></li>
        </ul>
    </footer>
</div>
</body>
</html>
<script type="text/template" id="history">
    <!-- 判断是否有搜索历史 -->
    <div class="mui-clearfix">
        <% if (!list || list.length > 0) { %>
            <span class="mui-pull-left">搜索历史</span>
            <span class="mui-pull-right fa fa-trash">清空记录</span>
        <%} else {%>
            <span class="mui-pull-left">没有搜索记录</span>
        <% } %>
    </div>
    <ul>
        <% if (list.length > 0) { %>
            <% for(var i = list.length -1; i >= 0; i--) { %>
            <!-- 渲染出一条条的搜索历史，并且可以点击再次搜索 -->
                <li><a href="searchList.html?key=<%= list[i] %>"><%= list[i] %></a><span data-index= <%= i %> class="mui-icon mui-icon-closeempty"></span></li>
            <% } %>
        <% } %>
    </ul>

</script>
<script src="assets/mui/js/mui.js"></script>
<script src="assets/zepto/zepto.min.js"></script>
<script src="assets/artTemplate/template-native.js"></script>
<script src="js/common.js"></script>
<script src="js/search.js"></script>